Skip to content

Correctly set Accept header to text/event-stream for completion streaming#94

Closed
mathetake wants to merge 1 commit intoopenai:mainfrom
mathetake:acceptheader
Closed

Correctly set Accept header to text/event-stream for completion streaming#94
mathetake wants to merge 1 commit intoopenai:mainfrom
mathetake:acceptheader

Conversation

@mathetake
Copy link
Copy Markdown

@mathetake mathetake commented Oct 23, 2024

Previously, the standard Accept header was set to application/json unconditionally.
However, streaming response returns content-type: text/event-stream following
the specification of server-sent-events.

This correctly sets the Accept header to it accordingly in order to comply with the
standard. The exact same problem exists in other SDKS (e.g. openai/openai-node#375, openai/openai-python#1815)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake requested a review from a team as a code owner October 23, 2024 16:47
Comment thread completion.go
@mathetake mathetake changed the title Correctly set Accept header to text/event-stream for streaming Correctly set Accept header to text/event-stream for completion streaming Oct 23, 2024
@mathetake mathetake closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants